{{ template "layout.html" . }}
{{define "title"}}
<title>添加文章</title>
{{end}}


{{define "main_body"}}
<div class="main_body" id="main_body">
  <div class="breadcrub">
    当前位置：文章管理>文章列表
  </div>
  <div class="pannel">
    <span class="sel_label">请选择文章分类：</span>
    <form id="form" method="GET" action="/Article/GetArticleList?pageIndex=1">
      <select name="select" id="select" class="sel_opt">
        <option >全部类型</option>

<!--        {{range .articletypes}}-->
<!--        &lt;!&ndash; 此处使用了模板函数 &ndash;&gt;-->
<!--        <option {{if eq .TypeName $.typename}} selected {{end}} >{{.TypeName}}</option>-->
<!--        {{end}}-->
      </select>
      <input type="submit" style="display:none">
    </form>
    <table class="common_table">
      <tr>
        <th width="40%">文章标题</th>
        <th width="10%">文章内容</th>
        <th width="12%">添加时间</th>
        <th width="12%">修改时间</th>
        <th width="6%">阅读量</th>
        <th width="6%">删除</th>
        <th width="6%">编辑</th>
      </tr>
      {{range $val := .articles}}
      <tr>
        <td>{{$val.Title}}</td>
        <td>{{$val.Content}}</td>
        <td>{{$val.CreateTime.Format "2006-01-02 15:04:05"}}</td>
        <td>{{$val.UpdateTime.Format "2006-01-02 15:04:05"}}</td>
        <td>{{$val.Count}}</td>
        <td><a href="/Article/DeleteArticle?id={{$val.Id}}" class="dels">删除</a></td>
        <td><a href="/Article/UpdateArticle?id={{$val.Id}}">编辑</a></td>
      </tr>
      {{end}}
    </table>
    <ul class="pagenation">
      <li><a href="/Article/GetArticleList?pageIndex=1">首页</a></li>
      {{if compare .EnableLast true}}
      <li><a href="/Article/GetArticleList?pageIndex={{.pageIndex | ShowLastPage }}">上一页 </a> </li>
      {{else}}
      <li>上一页</li>
      {{end}}
      {{if compare .EnableNext true}}
      <li> <a href="/Article/GetArticleList?pageIndex={{.pageIndex | ShowNextPage }}">下一页</a></li>
      {{else}}
      <li>下一页</li>
      {{end}}
      <li><a href="/Article/GetArticleList?pageIndex={{.pageCount}}">末页</a></li>
      <br>
      <li>共{{.count}}条记录/共{{.pageCount}}页/当前第{{.pageIndex}}页</li>
    </ul>
  </div>
</div>
{{end}}